package io;


import java.io.*;

//缓冲流
/*
        java.io.BufferedInputStream和BufferedOutputStream
        缓冲流在流的连接中的作用是加快读写效率
 */
public class CopeDemo3 {
    public static void main(String[] args) throws IOException {
        FileInputStream fi = new FileInputStream("./111.png");
        FileOutputStream fo = new FileOutputStream("./cp2_111.png");
        BufferedInputStream bis = new BufferedInputStream(fi);
        BufferedOutputStream op = new BufferedOutputStream(fo);

        byte[] num = new byte[10];
        int len;

        Long start = System.currentTimeMillis();

        while ((len = bis.read(num)) != -1){
            //    fo.write(num);
            op.write(num,0,len);
        }
        Long end = System.currentTimeMillis();
        System.out.println("复制完毕！！！,用时"+(end-start)+"ms");

        fi.close();
        fo.close();

    }
}
